﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:cmds="clr-namespace:MvvmFx.Common.ViewModels.Commands;assembly=MvvmFx.Common" xmlns:im="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions" xmlns:local="clr-namespace:MvvmFx.Samples.HowTos.CommandHandlers.View" x:Class="MvvmFx.Samples.HowTos.CommandHandlers.View.CommandHandlersSampleView" 
    Width="400" Height="300">
	<UserControl.Resources>
		<Storyboard x:Name="HandleRoutedCommandStoryboard">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)">
				<EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="180"/>
				<EasingDoubleKeyFrame KeyTime="00:00:01" Value="360"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Name="TypedCommandHandlerStoryboard">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)">
				<EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="180"/>
				<EasingDoubleKeyFrame KeyTime="00:00:01" Value="360"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
	</UserControl.Resources>
	<i:Interaction.Behaviors>
		<cmds:StoryboardCommandHandlerBehavior CommandPath="RoutedCommand" Storyboard="HandleRoutedCommandStoryboard"/>
	</i:Interaction.Behaviors>
    <Grid x:Name="LayoutRoot" Background="White">

    	<Button x:Name="button" cmds:Commands.Command="{Binding RoutedCommand}"  Height="30" Margin="31,56,160,0" VerticalAlignment="Top" Content="Execute Routed Command instance">
    		<Button.Projection>
    			<PlaneProjection/>
    		</Button.Projection>
    	</Button>

    	<Button HorizontalAlignment="Left" Margin="31,135,0,135" Width="163" Content="Execute Typed Command">
    		<i:Interaction.Triggers>
    			<i:EventTrigger EventName="Click">
    				<im:ControlStoryboardAction Storyboard="{StaticResource TypedCommandHandlerStoryboard}"/>
    			</i:EventTrigger>
    		</i:Interaction.Triggers>
    	</Button>
    	<Border x:Name="border" HorizontalAlignment="Right" Margin="0,135,39,135" Width="150" Background="#FFFFC844" BorderBrush="Black" BorderThickness="1" CornerRadius="4">
    		<Border.Projection>
    			<PlaneProjection/>
    		</Border.Projection>
    		<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Typed Command Handler" TextWrapping="Wrap"/>
    	</Border>
    	<TextBlock Height="18" HorizontalAlignment="Left" Margin="31,0,0,81" VerticalAlignment="Bottom" Width="163" Text="Sub view:" TextWrapping="Wrap"/>
    	<local:SubView Margin="31,0,0,47" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>

    </Grid>
</UserControl>
